/*    file: main.cpp
 *    desc:
 * 
 * created: 2016-04-06
 *  author: chuanjiang.zh@qq.com
 * company: 
 */

#include <stdio.h>
#include <iostream>

#include "BasicType.h"
#include "SharedPtr.h"
#include "TFileUtil.h"
#include "TByteBuffer.h"
#include "BasicMacro.h"
#include "TStringUtil.h"
#include <assert.h>
#include <errno.h>
#include "RtpSound.h"
#include "DateTime.h"
#include "Path.h"
#include <memory>


class Application 
{
public:
	Application()
	{
	    rtpsound_init();
	}

	~Application()
	{
	    rtpsound_quit();
	}

};


int main(int argc, char** argv)
{
	int port = 10000;

	if (argc > 1)
	{
		comn::StringCast::toValue(argv[1], port);
	}

	Application app;

	int codec = RTPSOUND_CODEC_G711U;
	int handle = rtpsound_open(port, codec, 1, 8000);
	double volume = rtpsound_getVolume(handle);
	
	while (true)
	{
		std::cout << "$ ";
		
		std::string line;
		std::getline(std::cin, line);
		if (line == "q")
		{
		    break;
		}
	}

	rtpsound_close(handle);
	
	return 0;
}




